home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 501-525 / disk_514 / tlog / addevent.tlog < prev    next >
Text File  |  1992-05-06  |  3KB  |  103 lines

  1. /* AddEvent.tlog  --  inserts an event into the NAG scheduler from tlog  */
  2. /* Use this as a template for adding "events" to you own scheduler.      */
  3. /* tlog is a athelete's training diary by E. F. Bacon                    */
  4.  
  5. /* The basis for this script comes from ...                              */
  6. /* addnag.rexx - inserts requestored NAGPLUS event into current nag-year */
  7.  
  8. /*      copyright 1989 Richard Lee Stockton and Gramma Software.         */
  9. /*    This code is freely distributable as long as this copyright        */
  10. /*   notice remains, unchanged, at the start of the code. Thank you.     */
  11.  
  12.  
  13. OPTIONS RESULTS
  14. SIGNAL ON BREAK_C
  15.  
  16. /* add the necessary libraries */
  17. IF(~EXISTS("libs:rexxsupport.library")|~EXISTS("libs:rexxarplib.library")) THEN
  18.  DO
  19.     SAY "Couldn't find needed library (rexxsupport and/or rexxarplib)."
  20.     EXIT 20
  21.  END
  22. CALL ADDLIB('rexxsupport.library',0,-30,0)
  23. CALL ADDLIB('rexxarplib.library',0,-30,0)
  24.  
  25.  
  26. return_text = "0"
  27. priport     = ""
  28. success     = 0
  29.  
  30. address 'tlog'
  31.  
  32. /* Get the CurrentDate from the Tlog Calendar; the ISO dateformat (1)  */
  33. /* works well with NAG. Your scheduler may like a different format.    */
  34. getdateformat
  35. oldformat = result
  36. dateformat 1
  37. currentdate
  38. datestring = result
  39. dateformat oldformat
  40.  
  41. /* NAG specific variables to set port and prompt. nagfront is fragment   */
  42. /* of NAG specific way to schedule an event from its AREXX port; it gets */
  43. /* appended below.                                                       */
  44. nagport   = 'NagRexx1'
  45. nagfront  = SUBSTR(datestring,3,4)
  46.  
  47. nagprompt = ""
  48. /* To use the last known, prompt remove the comments from the next line */
  49. /* nagprompt = GETCLIP('nag_event') */
  50.  
  51. /* Form nag prompt from the tlog currentdate and the nag_event !ACTION! */
  52. /* with 1 voice and sound nag.                                          */
  53. /* NAG allows you to define your own events a better one might be RACE! */
  54. /* Another improvement is to add the datestring to the nagevent. NAG has*/
  55. /* a feature that when a token is selected from the event text, a text  */
  56. /* editor is invoked.  Thus if NOTEDIR and NOTEEXT of tlog match the NAG*/
  57. /* equivalents, you can link a diary entry to tlog and to your scheduler*/
  58. /* However, see the note about the "11 char test" below.                */
  59.  
  60. IF nagprompt=="" THEN nagprompt=nagfront"0000ZI"
  61.  
  62.  
  63. /* Where the 'pretty' stuff gets done. 'nagevent' is text to insert */
  64.  
  65. CALL SCREENTOFRONT()
  66.  
  67. nagevent = Request(50,50,,
  68. "                ADD an Event to NAGPLUS\\
  69. MM=Month, DD=Day, HH=Hours, NN=miNutes, ZI=sound/voice nag\\
  70. MMDDHHNNZIYour event text (up to 48 characters) goes here.",,
  71. nagprompt,"ADD","CANCEL")
  72.  
  73. CALL SCREENTOBACK()
  74.  
  75. /*  if the text less than 11 chars (no event text), quietly return */
  76. /*  otherwise, insert in NAGPLUS, (assuming I can find it)  */
  77. /* N.B. the 11 chars test is nagprompt dependent you may have to change */
  78. /* this if clause */
  79. IF LENGTH(nagevent)>10 THEN
  80.  DO
  81.     ADDRESS VALUE nagport
  82.     lock
  83.     priport = RESULT
  84.     IF(priport~="" & priport~="RESULT") THEN
  85.      DO
  86.         ADDRESS VALUE priport
  87.         IF LENGTH(nagevent)>59 THEN nagevent=LEFT(nagevent,59)
  88.         set 4   /* set to this year */
  89.         edit nagevent
  90.         unlock
  91.         IF ~SETCLIP('nag_event',nagevent) THEN return_text = "CLIP_FAILURE"
  92.      END
  93.     ELSE return_text = "PORT_LOCK_FAILURE"
  94.  END
  95.  
  96. EXIT return_text
  97.  
  98.  
  99. BREAK_C:
  100.  
  101. IF SHOWLIST(p,priport) THEN unlock
  102. EXIT 'ABORT'
  103.